<template>
  <!-- 会员中心模板1 -->
  <div>
    <!-- 定制 松鼠小屋  start -->
    <section class="u-id-s2-card"
             v-if="memberInfo.xiaowu_dz==1">
      <div class="u-id-s2-actions-title">
        我是您的松鼠小屋团长
        <i>购买、售后、取货，任何不懂的联系我</i>
      </div>
      <div class="card-item clearfix">
        <div class="card-img fl">
          <a href="javascript:;">
            <img :src="memberInfo.my_agent.headimgurl"
                 width="60"
                 height="60"
                 alt />
          </a>
        </div>
        <div class="card-text">
          <p>
            <i>微信昵称：</i>
            <span>{{memberInfo.my_agent.nickname}}</span>
          </p>
          <p>
            <i>微信号：</i>
            <span>{{memberInfo.my_agent.weixin_account}}</span>
          </p>
          <p>
            <i>手机号：</i>
            <span>{{memberInfo.my_agent.mobile}}</span>
          </p>
        </div>
      </div>
    </section>
    <!-- 定制 松鼠小屋  end -->
    <div class="u-id-s2-links clearfix style2">
      <div class="u-id-s2-links-title">
        <h3>我的订单</h3>
        <p @click="Jump('/order-lists')">查看全部</p>
      </div>
      <div class="link-list">
        <!-- 待付款 -->
        <div class="link"
            @click="Jump('/order-lists?type=2')">
          <i class="icon-links icon1_1"></i>
          <span class="title">{{memberInfo.ftitle_pending_pay}}</span>
          <span class="num"
                v-if="memberInfo.wait_total!=0">{{memberInfo.wait_total}}</span>
        </div>
        <!-- 已付款 -->
        <div class="link"
            @click="Jump('/order-lists?type=6')">
          <i class="icon-links icon1_2"></i>
          <span class="title">{{memberInfo.ftitle_has_pay}}</span>
          <span class="num"
                v-if="memberInfo.ispay_total!=0">{{memberInfo.ispay_total}}</span>
        </div>
        <!-- 已发货 -->
        <div class="link"
            @click="Jump('/order-lists?type=3')">
          <i class="icon-links icon1_5"></i>
          <span class="title">{{memberInfo.ftitle_has_shipped}}</span>
          <span class="num"
                v-if="memberInfo.send_total!=0">{{memberInfo.send_total}}</span>
        </div>
        <!-- 待评价 -->
        <div class="link"
            v-if="memberInfo.is_comment == 1"
            @click="Jump('commentList',{type:'evaluate'})">
          <i class="icon-links icon2_2"></i>
          <span class="title">{{memberInfo.ftitle_comment_list}}</span>
          <span class="num">{{memberInfo.wait_comment_list}}</span>
        </div>
        <!-- 退换货 -->
        <div class="link"
            v-if="memberInfo.is_allow_exchange==1 && memberInfo.is_allow_return==1"
            @click="Jump('/order-lists?type=4')">
          <i class="icon-links icon1_3"></i>
          <span class="title">{{memberInfo.ftitle_return_goods}}</span>
          <span class="num"
                v-if="memberInfo.return_total!=0">{{memberInfo.return_total}}</span>
        </div>
        <!-- 换货 -->
        <div class="link"
            v-else-if="memberInfo.is_allow_exchange==1"
            @click="Jump('/order-lists?type=4')">
          <i class="icon-links icon1_3"></i>
          <span class="title">换货</span>
          <span class="num"
                v-if="memberInfo.return_total!=0">{{memberInfo.return_total}}</span>
        </div>
        <!-- 退货 -->
        <div class="link"
            v-else-if="memberInfo.is_allow_return==1"
            @click="Jump('/order-lists?type=4')">
          <i class="icon-links icon1_3"></i>
          <span class="title">退货</span>
          <span class="num"
                v-if="memberInfo.return_total!=0">{{memberInfo.return_total}}</span>
        </div>
        <!-- 已完成 -->
        <div class="link"
            v-else
            @click="Jump('/order-lists?type=7')">
          <i class="icon-links icon1_3"></i>
          <span class="title">已完成</span>
          <span class="num"
                v-if="memberInfo.fina_total!=0">{{memberInfo.fina_total}}</span>
        </div>
        <!-- 全部 -->
        <!-- <div class="link master"
            @click="Jump('/order-lists')">
          <i class="icon-links icon1_4"></i>
          <span class="title">{{memberInfo.ftitle_all_orders}}</span>
          <span class="num"
                v-if="memberInfo.all_total!=0">{{memberInfo.all_total}}</span>
        </div> -->

        <!-- <div class="link"
            @click="Jump('mycoupon')">
          <i class="icon-links icon2_1"></i>
          <span class="title">{{memberInfo.ftitle_coupon}}</span>
          <span class="title_detail">{{memberInfo.coupon_num}}张可用</span>
        </div>

        <div class="link"
            @click="Jump('collectionGoods')">
          <i class="icon-links icon2_4"></i>
          <span class="title">{{memberInfo.ftitle_collection}}</span>
          <span class="title_detail">{{memberInfo.collection_num}}</span>
        </div>
        <div class="link"
            @click="Jump('balanceTx')">
          <i class="icon-links icon2_3"></i>
          <span class="title">{{memberInfo.account_balance}}</span>
          <span class="title_detail">{{memberInfo.balance}}</span>
        </div> -->
      </div>
    </div>
    <section class="mainmodule">
      <!-- 普通会员 -->
      <div class="mianad"
           v-if="memberInfo.is_user_img == 1">
        <a @click="JumpUrl(memberInfo.user_img_link)">
          <img :src="memberInfo.user_img_ggt"
               alt
               v-if="memberInfo.user_img_ggt" />
        </a>
      </div>
      <!-- 慈善关爱金 开始 -->
      <div class="csjj" v-if="memberInfo.charity_compassion_dz == 1">
        <div class="div1">
          <img  src="https://img.wifenxiao.com/h5-wfx/images/基金.png" alt="">
        </div>
        <div class="div2">
          慈善关爱金：¥ {{memberInfo.charity_compassion_money}}
        </div>
      </div>
      <!-- 慈善关爱金 结束 -->
      <!-- TODO 小程序文字滚动 -->
      <div class="lunbo" id="lunbo" v-if="memberInfo.is_affiche==1">
        <p id="lunbo-p" class="lunbo-p" :style="{color:'#'+ memberInfo.affiche_color}">
          <span v-for="(item,index) in memberInfo.affiche"
                :key="index">{{item}}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
        </p>
      </div>
      <div class="mainlist">
        <ul>
          <li>
            <div class="icon0_1"
                 @click="Jump('orderAllLists')">
              我的订单
              <i class="icon-right"></i>
            </div>
          </li>
          <!-- 汇付、通联开户 start -->
          <li v-if="memberInfo.is_opened">
            <div class="icon26_open"
                @click="showOpenCard(memberInfo.is_opened)">
              点我开户
              <svg-icon icon-class="icon_right"
                        class="icon_right"></svg-icon>
            </div>
          </li>
          <!-- 汇付、通联开户 end -->
          <li v-if="memberInfo.cjh_dz">
            <div class="icon_cjh"
                 @click="handleLinkTo('memberBuyRecord')">
              会员购买记录
              <i class="icon-right"></i>
            </div>
          </li>
          <li v-if="memberInfo.show_point">
            <div class="icon_jf"
                 @click="Jump('point')">
              {{memberInfo.ftitle_point}}
              <i class="icon-right"></i>
            </div>
          </li>
          <li v-if="memberInfo.show_virtual &&memberInfo.is_virtual_currency">
            <div class="icon_xnb"
                 @click="Jump('virtualCurrency')">
              {{memberInfo.virtual_currency_title}}
              <i class="icon-right"></i>
            </div>
          </li>
          <li v-if="memberInfo.show_recharge">
            <div class="icon_zhcz"
                 @click="Jump('rechargeList')">
              {{memberInfo.ftitle_recharge}}
              <i class="icon-right"></i>
            </div>
          </li>
          <!-- 定制 薇曼 start -->
          <li v-if="memberInfo.is_wm_dz">
            <div class="icon_crowdlists"
              @click="handleLinkTo('balanceSend')">
              余额赠送
              <i class="icon-right"></i>
            </div>
          </li>
          <!-- 定制 薇曼 end -->
          <!-- <li v-if="memberInfo.show_myOrder">
            <div class="icon_yfkdd"
                 @click="Jump('/order-lists?type=3')">
              {{memberInfo.ftitle_has_pay}}
              <i class="icon-right"></i>
            </div>
          </li> -->
          <li v-if="memberInfo.has_duodian && memberInfo.is_show_collection_shop && memberInfo.show_collection_shop">
            <div class="icon_shop"
                 @click="Jump('collectionShop')">
              {{memberInfo.ftitle_collection_shop}}
              <i class="icon-right"></i>
            </div>
          </li>
          <li v-if="memberInfo.show_user_share_card">
            <div class="icon_card"
                 @click="getUserCard('userCard')">
              我的名片
              <i class="icon-right"></i>
            </div>
          </li>
          <li v-if="memberInfo.is_member_card">
            <div class="icon_vip"
                 @click="onVipCardJump('cardDetail')">
              会员卡
              <i class="icon-right"></i>
            </div>
          </li>
          <li v-if="memberInfo.show_auction">
            <div class="icon_pm"
                 @click="Jump('myAuction')">
              拍卖
              <i class="icon-right"></i>
            </div>
          </li>
          <li v-if="memberInfo.is_try">
            <div class="icon_trylists"
                 @click="Jump('tryList')">
              我参与的试用活动
              <i class="icon-right"></i>
            </div>
          </li>
          <!-- <notempty name="is_crowd">
							<li><a href="/User/crowdList" class="icon_crowdlists">我参与的夺宝活动
							<i class="icon-right"></i></a></li>
          </notempty>-->
        </ul>
        <ul>
          <li v-if="memberInfo.show_modify">
            <div class="icon_xgzl"
                 @click="Jump('changeUserData')">
              {{memberInfo.ftitle_change_data}}
              <i class="icon-right"></i>
            </div>
          </li>
          <li v-if="memberInfo.show_address">
            <div class="icon_dzgl"
                 @click="Jump('addressList')">
              {{memberInfo.ftitle_address}}
              <i class="icon-right"></i>
            </div>
          </li>
        </ul>
        <ul>
          <li v-if="memberInfo.show_numerous">
            <!-- <div to="{:U('Collect/lists/status/3')}"
                 class="icon_wdzc"
                 @click="Jump('')">
              我的众筹
              <i class="icon-right"></i>
            </div> -->
            <a @click="JumpUrl(memberInfo.collect_url)"
               class="icon_wdzc">
              我的众筹
              <i class="icon-right"></i>
            </a>
          </li>
          <li v-if="memberInfo.show_privilege">
            <div class="icon_hydj"
                 @click="Jump('memberBenefits')">
              <!-- 会员权益 -->
              {{memberInfo.ftitle_rank}}
              <i class="icon-right"></i>
            </div>
          </li>
          <li v-if="memberInfo.show_interaction">
            <div class="icon_hyhd"
                 @click="Jump('game-list')">
              {{memberInfo.ftitle_game}}
              <i class="icon-right"></i>
            </div>
          </li>
          <li v-if="memberInfo.friend_count && memberInfo.show_myFriend">
            <div class="icon_wdhy"
                 @click="Jump('myFriend')">
              {{memberInfo.ftitle_friend}}
              <b class="numB">{{memberInfo.friend_count}}</b>
              <i class="icon-right"></i>
            </div>
          </li>
          <!-- 我的服务 -->
          <li v-if="memberInfo.show_myService">
            <div class="icon_hymyserve"
                 @click="Jump('my-serve')">
              {{memberInfo.ftitle_my_serve}}
              <i class="icon-right"></i>
            </div>
          </li>
          <!-- TODO 传播宝暂时隐藏 -->
          <!-- <li v-if="memberInfo.open_chuan_bo_bao==1">
            <a @click="JumpUrl(memberInfo.chuan_bo_bao_url)"
               class="icon_cbb">
              传播宝
              <i class="icon-right"></i>
            </a>
          </li> -->
          <!--Todo: 展示的判断未加-->
          <li v-if="memberInfo.show_dls_upgrade">
            <div class="icon_wysj" @click="Jump('upgrade-lv')">
              会员升级
              <i class="icon-right"></i>
            </div>
          </li>
          <li v-if="memberInfo.show_micro_course==1">
            <div class="icon_course" @click="Jump('myCourse')">
              我的课程
              <i class="icon-right"></i>
            </div>
          </li>

          <!-- 定制 小皇鱼 start -->
          <li v-if="memberInfo.is_dz_xhy">
            <div class="icon_ewm"
                 @click="handleLinkTo('serviceCode')">
                 <!-- @click="JumpUrl('/User/serviceCode')"> -->
              服务二维码
              <i class="icon-right"></i>
            </div>
          </li>
          <li v-if="memberInfo.is_dz_xhy">
            <div class="icon_upload"
                 @click="handleLinkTo('uploadCode')">
                 <!-- @click="JumpUrl('/User/uploadCode')"> -->
              上传二维码
              <i class="icon-right"></i>
            </div>
          </li>
          <li v-if="memberInfo.is_dz_xhy">
            <div class="icon_tjitem"
                 @click="handleLinkTo('growingFansList')">
                 <!-- @click="JumpUrl('/User/growingFansList')"> -->
              涨粉列表
              <i class="icon-right"></i>
            </div>
          </li>
          <!-- 定制 小皇鱼 end -->

          <li v-if="memberInfo.show_highLevel_center && memberInfo.superior_user_id">
            <div class="icon_wdsjc"
                 @click="Jump('userSupplier')">
              {{memberInfo.user_supplier}}
              <i class="icon-right"></i>
            </div>
          </li>
          <!-- 定制 上海透缇 start -->
          <li v-if="memberInfo.is_ti_dz">
            <div class="icon_wdmember"
                 @click="JumpUrl('/nextLevelMember')">
              我的会员
              <i class="icon-right"></i>
            </div>
          </li>
          <!-- 定制 上海透缇 end -->
          <!-- 定制 乐拍拍 start -->
          <li v-if="memberInfo.lpp_dz==1">
              <div @click="handleLinkTo('auctionReturn')" class="icon_yfkdd">
              拍卖返现
              <i class="icon-right"></i>
              </div>
          </li>
          <!-- 定制 乐拍拍 end -->
          <!-- 定制 净水器 start -->
          <li v-if="memberInfo.is_dz_waterCleaner">
            <div class="icon_binding"
                 @click="handleLinkTo('waterCleaner')">
              绑定净水器
              <i class="icon-right"></i>
            </div>
          </li>
          <!-- 定制 净水器 end -->
          <!-- 定制 股权信息 start -->
          <li v-if="memberInfo.is_JTJK_DZ">
            <div class="icon_tjitem"
                 @click="handleLinkTo('stockRight')">
              股权信息
              <i class="icon-right"></i>
            </div>
          </li>
          <!-- 定制 股权信息 end -->
          <!-- 欧普定制 start-->
          <li v-if="memberInfo.is_op_dz==1">
            <div class="icon_binding op_dz_binding" @click="showVerifyMobilePop">
              绑定手机号
               <i class="icon-right"></i>
            </div>
          </li>
          <!-- 欧普定制 end-->
          <!-- 定制 现金积分  start -->
          <li v-if="memberInfo.dz_cash_point">
            <div class="icon_xjjf"
                 @click="handleLinkTo('dzPoint')">
              {{memberInfo.dz_cash_point_name}}
              <svg-icon icon-class="icon_right"
                        class="icon_right"></svg-icon>
            </div>
          </li>
          <!-- 定制 现金积分 end -->
          <!-- 定制 职乐通联二选一 start -->
          <li v-if="memberInfo.is_member_select">
            <div class="icon17_1_fzxz"
                 @click="selectMemberType()">
              修改分账
              <svg-icon icon-class="icon_right"
                        class="icon_right"></svg-icon>
            </div>
          </li>
          <!-- 定制 职乐通联二选一 ent -->
          <li v-if="memberInfo.showShareLink">
            <div @click="Jump('/shareSelect')" class="icon20_1_fx">
              万能链接
              <i class="icon-right"></i>
            </div>
          </li>

          <li v-if="memberInfo.is_skin_detection_dz">
            <div @click="Jump('/aiTest')" class="icon21_1_ai">
              面部AI检测
              <svg-icon icon-class="icon_right" class="icon_right"></svg-icon>
              <i class="icon-right"></i>
            </div>
          </li>
          <!-- 订单兑换有礼 -->
          <li v-if="memberInfo.is_order_convert">
            <div @click="handleLinkTo('convertSetting')" class="icon23_dhyl">
              {{memberInfo.order_convert_name}}
              <i class="icon-right"></i>
            </div>
          </li>
          <li v-if="memberInfo.is_display_sharer">
            <div @click="handleLinkTo('bindShare')" class="icon24_sxy">
              成为分享员
              <i class="icon-right"></i>
            </div>
          </li>
          <li v-if="isAgreement.register_agreement">
            <div @click="handleLinkTo('userAgreement')" class="icon25_yhxy">
              用户协议
              <svg-icon icon-class="icon_right" class="icon_right"></svg-icon>
            </div>
          </li>
          <li v-if="isAgreement.privacy_agreement">
            <div @click="handleLinkTo('privacyAgreement')" class="icon25_ysxy">
              隐私协议
              <svg-icon icon-class="icon_right" class="icon_right"></svg-icon>
            </div>
          </li>
        </ul>
        <ul v-if="memberInfo.dataset && memberInfo.dataset.length>0">
          <li v-for="(item,index) in memberInfo.dataset"
              :key="index">
            <a @click="JumpUrl(item.link)"
               class="custom_item"
               :style="{backgroundImage: 'url('+item.pic+')'}">
              {{item.showtitle}}
              <i class="icon-right"></i>
            </a>
          </li>
        </ul>
      </div>
    </section>

    <!-- <input type="hidden" value="{$code}" id="check_code"> -->
    <!-- <section class="mlogin-but style1"
             v-if="memberInfo.is_wx!=1 && memberInfo.isAfb!=1">
      <a href="javascript:;"
         class="red-gra-btn"
         v-if="memberInfo.isAppIos"
         @click="loginOutChild">退出登录</a>
      <a href="javascript:;"
         class="red-gra-btn"
         v-else-if="!memberInfo.isAppIos && memberInfo.is_priview"
         @click="loginOutChild">退出登录</a>
      <a href="javascript:;"
         class="red-gra-btn"
         v-else-if="!memberInfo.isAppIos"
         @click="loginOutChild">退出登录</a>
    </section> -->
    <!-- <div style="display: none;">{$random_content}</div> -->
    <template  v-if="memberInfo.user_cencal_status == 1">
      <div class="mengniu-status" v-if="memberInfo.user_cencal_time">注销时间：{{memberInfo.user_cencal_time}}</div>
    </template>
  </div>
</template>
<script>
import Vue from 'vue'
import { openPage } from '@/utils/utils.js'
import { syncSaveInfo } from '@/api/user/member/memberApi'
export default Vue.extend({
  props: {
    memberInfo: {
      type: Object
    },
    isAgreement: {
      type: Object,
      default: {
        register_agreement: 0,
        privacy_agreement: 0
      }
    }
  },
  data() {
    return {
      avatarUrl:'',
      nickName:''
    }
  },
  methods: {
    Jump(url, data) {
      this.$JumpPath(this, url, data, 0)
    },
    JumpUrl(url) {
      // TODO 小程序跳转
        openPage(url)
    },
    updateUserInfo(){
      syncSaveInfo({
        headimgurl:this.avatarUrl,
        nickname:this.nickName,
      }).then((res)=>{
        this.Jump('userCard')
      })
    },
    getUserCard(){
      this.Jump('userCard')
    },
    handleLinkTo(url, data) {
      this.$JumpName(this, url, data)
    },
    onVipCardJump(path) {
      this.memberInfo.is_show_buy_card ? this.Jump('cardList') : this.Jump(path)
    },
    loginOutChild() {
      this.$emit('loginOut')
    },
    // 欧普定制增加绑定手机号
    showVerifyMobilePop() {
      this.$Bus.$emit('showVerifyMobilePop', { show: true })
    },
    // 定制 职乐-通联分账修改
    selectMemberType() {
      this.$emit('selectMemberType')
    },
    // 点我开户
    showOpenCard(type) {
      if (type == 1) {
        this.handleLinkTo('openingSeparateAccount', { type: 1, company: this.memberInfo.tlfz_info.tlfz_company_open_account, person: this.memberInfo.tlfz_info.tlfz_person_open_account})
      } else if (type == 2) {
        this.showBalancePopApapay()
      }
    },
    // 汇付开户
    showBalancePopApapay() {
      const adapay_info = this.memberInfo.adapay_info
      // console.log('adapay_info', adapay_info.adapay_company_apply_status)

      if (adapay_info.adapay_company_apply_status == 0) {
        this.$Error(adapay_info.adapay_fail)
      } else if (adapay_info.adapay_company_apply_status == 2) {
        this.handleLinkTo('openingSeparateAccount', { hfActive: 5, hfType: 2, type: 2 })
      } else {
        if (adapay_info.step == 0) {
          if (adapay_info.adapay_company_apply_status == 2) {
            this.$Error(adapay_info.adapay_fail)
          }
          this.handleLinkTo('openingSeparateAccount', { hfActive: 0, type: 2 })
        } else if (adapay_info.step == 1) {
          this.handleLinkTo('openingSeparateAccount', { hfActive: 2, hfType: 1, type: 2 })
        }
      }
    }
  },
  created() {
    // console.log(this.memberInfo)
  }
})
</script>
<style lang="scss">
@import '../../../../../styles/user/index.scss';
@import '../../../../../styles/user/member/index';
.csjj {
  width: 90%;
  margin-left: 5%;
  background-color: #FFFAE5;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  .div1 {
    width: 15%;
  }
  .div2 {
    font-size: 32px;
    font-weight: bolder;
    color: #f12121;
  }
  img {
    width: 88px;height: 88px;
  }
}
</style>
